home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Education / PSI / Eliza 1.0 / card_2952.txt < prev    next >
Encoding:
Text File  |  1988-04-23  |  8.3 KB  |  298 lines

  1. -- card: 2952 from stack: in.0
  2. -- bmap block id: 4110
  3. -- flags: 0000
  4. -- background id: 2639
  5. -- name: 
  6. ----- HyperTalk script -----
  7.  
  8. on openCard
  9.   put empty into card field 1
  10.   put empty into card field 2
  11.   put "Human's Response" into card field 4
  12.   show message
  13.   set cursor to 4
  14.   SpeakOne "Hello, I'm Eliza.  Tell me your problems.", "Hi, I'm Doctor Eliza.  Tell me your problems.", "Hi, this is Eliza.  Let me help you. Tell me your problems.", "I am Eliza.  How do you do.  What is your name?"
  15.   wait for 2 seconds
  16.   click at loc of message
  17.   type " " & the numToChar of 8
  18. end openCard
  19.  
  20. on enterKey
  21.   QAT
  22. end enterKey
  23.  
  24. on returnKey
  25.   QAT
  26. end returnKey
  27.  
  28. -- QAT is the pick up service routine
  29. -- it takes control after the human responds.
  30. --
  31. on QAT
  32.   Global OriginalMessage
  33.   get message
  34.   put it into OriginalMessage
  35.   set cursor to 4
  36.   put Trim(RemovePuncs(it)) into card field 1
  37.   Eliza
  38. end QAT
  39.  
  40. ---------------------------------------------------------------
  41.  
  42.  
  43. -- here is the biggie.  Doctor (Ms.) Eliza herself.
  44. --
  45.  
  46. on Eliza
  47.   Global HumanName
  48.   Global StashedResponse
  49.   Global OriginalMessage
  50.   set cursor to 4
  51.   put card field 2 into WhatISaid
  52.   put empty into card field 2
  53.   put card field 1 into response
  54.   put word 1 of response into A
  55.   put word 2 of response into B
  56.   put word 3 of response into C
  57.   put A && B into AB
  58.   put AB && C into ABC
  59.   if (the random of 10) is 1 then put response into StashedResponse
  60.   put Trim(ReverseRole(butFirst(response,2))) into TRBF
  61.  
  62.  
  63.   -- no response
  64.   if response is empty then
  65.     SpeakOne "Please do speak.", "What's troubling your mind ?", "Let me help you with your problems.", "Hm ..."
  66.     exit Eliza
  67.   end if
  68.  
  69.   -- "Can you ..."
  70.   if AB is "Can you" then
  71.     SpeakOne "Don't you believe that I can " & TRBF & " ?", "Perhaps you would like to be able to " & TRBF, "You want me to be able to " & TRBF, "One can do anything one wills, if the will is strong enough."
  72.     exit Eliza
  73.   end if
  74.  
  75.   -- "Can I ..."
  76.   if AB is "Can I" then
  77.     SpeakOne "Perhaps you don't want to " & TRBF, "Do you want to be able to " & TRBF, "If you think you can, you can."
  78.     exit Eliza
  79.   end if
  80.  
  81.   -- "You are ..." or "You're ..."
  82.   if AB is "You are" or A is "Youre" then
  83.     if  response contains "no" or response contains "not" then
  84.       SpeakOne "Why do you think I'm not " & TRBF & " ?", "Why not ?", "Why are't I?"
  85.       exit Eliza
  86.     else
  87.       SpeakOne "What makes you think I am " & TRBF, "Does it please you to believe I'm " & TRBF, "Perhaps you would like to be " & TRBF, "Do you sometimes wish you were " &TRBF
  88.       exit Eliza
  89.     end if
  90.   end if
  91.  
  92.   -- "I dont ..."
  93.   if AB is "I dont" or ABC is "I do not" then
  94.     SpeakOne "Don'y you really " & TRBF, "Really, now ...", "Why don't you " & TRBF, "Do you wish to be able to " & TRBF, "Does that trouble you ?", "Does it mean that much to you ?"
  95.     exit Eliza
  96.   end if
  97.  
  98.   -- "I feel ..."
  99.   if AB is "I feel" then
  100.     SpeakOne "Tell me more about such feelings.", "Hm ...", "Do you often feel " & TRBF, "Do you enjoy feeling " & TRBF, "Does it worry you to feel " & TRBF
  101.     exit Eliza
  102.   end if
  103.  
  104.   -- "Why dont you ..."
  105.   if ABC is "why dont you" then
  106.     SpeakOne "Do you really believe that I dont " & TRBF, "Perhaps in good time I will " & TRBF, "Do you want me to " & TRBF
  107.     exit Eliza
  108.   end if
  109.  
  110.   -- "Why cant I ..."
  111.   if ABC is "why cant I" then
  112.     SpeakOne "Do you think you should be able to " & TRBF, "Why can't you " & TRBF, "I think you know the answer."
  113.     exit Eliza
  114.   end if
  115.  
  116.   -- "Are you ..."
  117.   if AB is "are you" then
  118.     SpeakOne "Why are you interested in whether or not I am " & TRBF, "Would you prefer if I were not " & TRBF, "Perhaps in your fantasies I am " & TRBF
  119.     exit Eliza
  120.   end if
  121.  
  122.   -- "I cant ..."
  123.  
  124.  
  125.   -- pick up name in response to question "what is your name"
  126.   if WhatISaid contains "what is your name" and the number of words in response < 3 then
  127.     beep
  128.     put "My name is " before response   -- to be taken care of next
  129.   end if
  130.  
  131.   -- "My name is ..."
  132.   if word 1 to 3 of response is "My name is" then
  133.     put line 3 of breakKey(response,"My name is") into HumanName
  134.     put word 1 of HumanName & "'s Response" into card field 4
  135.     SpeakOne "Good, " & HumanName & ".  Nice to meet you.", HumanName & ", let me know your problems.", "Go on ..."
  136.     exit Eliza
  137.   end if
  138.  
  139.   -- "Can I ask you ..."
  140.   if word 1 to 4 of response is "can I ask you" then
  141.     put line 3 of Trim(breakKey(response,"can I ask you")) into temp
  142.     SpeakOne "Go right ahead, " & HumanName, "Please do.", "Why would you ask me " & reverseRole(temp) & " ?", "Why ?"
  143.     exit Eliza
  144.   end if
  145.  
  146.   -- "Hello" or "Hi"
  147.   if response contains "Hello" or response contains "Hi" then
  148.     SpeakOne "Hello.", "Hi !", "Hello.  Now tell me your problems.", "Nice to meet you.", "Hello, what is your name?"
  149.     exit Eliza
  150.   end if
  151.  
  152.   -- "How do you do"
  153.   if response contains "How do you do" then
  154.     if HumanName is empty then Articulate "What is your name?" else SpeakOne "How do you do.", "Nice to meet you."
  155.     exit Eliza
  156.   end if
  157.  
  158.   -- "How are you?"
  159.   if response is "how are you" then
  160.     Articulate "Fine.  How about you?"
  161.     exit Eliza
  162.   end if
  163.  
  164.   -- short response
  165.   if length of response < 5 and the random of 5 is 1 then
  166.     SpeakOne "...", "Hm ...", "You are not very talkative today", "Please, calm down, " & HumanName,""
  167.     exit Eliza
  168.   end if
  169.  
  170.   -- "goodbye"
  171.   if A is "goodbye" then
  172.     Articulate "good-bye."
  173.     visual effect dissolve
  174.     go home
  175.     exit Eliza
  176.   end if
  177.  
  178.   -- no cases; fell through == make use of the stashed response
  179.   if (the random of 5 is 1) and StashedResponse is not empty then
  180.     Articulate "Earlier you said, '" & StashedResponse &"'"
  181.     exit Eliza
  182.   end if
  183.  
  184.   -- no cases; fell through
  185.   SpeakOne "", "Hm ...", "Please go on.", "I see.", "Want to discuss your psychological problems now ?", "What does that suggest to you ?", "That is quite interesting.", "I'm not sure I understand you fully.", "What do you mean ?", "Come, come, elucidate on your thoughts.", "Really ?", "Can you elaborate on that ?", "Perhaps we may talk about your childhood ?"
  186.  
  187. end Eliza
  188.  
  189. on Articulate msg
  190.   click at loc of card field 2
  191.   type msg
  192.   put empty into message
  193.   click at loc of message
  194.   type " " & the numToChar of 8
  195. end Articulate
  196.  
  197. on SpeakOne
  198.   Articulate the param of (the random of the paramcount)
  199. end SpeakOne
  200.  
  201.  
  202.  
  203. ================================================================
  204. ================================================================
  205. ================================================================
  206. ================================================================
  207. ================================================================
  208.  
  209.  
  210. -- part 1 (field)
  211. -- low flags: 01
  212. -- high flags: 0004
  213. -- rect: left=24 top=251 right=278 bottom=491
  214. -- title width / last selected line: 0
  215. -- icon id / first selected line: 0 / 0
  216. -- text alignment: 0
  217. -- font id: 3
  218. -- text size: 14
  219. -- style flags: 0
  220. -- line height: 18
  221. -- part name: 
  222.  
  223.  
  224. -- part 3 (field)
  225. -- low flags: 00
  226. -- high flags: 0004
  227. -- rect: left=24 top=198 right=225 bottom=491
  228. -- title width / last selected line: 0
  229. -- icon id / first selected line: 0 / 0
  230. -- text alignment: 0
  231. -- font id: 3
  232. -- text size: 14
  233. -- style flags: 0
  234. -- line height: 18
  235. -- part name: 
  236.  
  237.  
  238. -- part 4 (field)
  239. -- low flags: 01
  240. -- high flags: 0004
  241. -- rect: left=24 top=174 right=197 bottom=193
  242. -- title width / last selected line: 0
  243. -- icon id / first selected line: 0 / 0
  244. -- text alignment: 0
  245. -- font id: 0
  246. -- text size: 12
  247. -- style flags: 0
  248. -- line height: 16
  249. -- part name: 
  250.  
  251.  
  252. -- part 5 (field)
  253. -- low flags: 01
  254. -- high flags: 0004
  255. -- rect: left=24 top=227 right=250 bottom=193
  256. -- title width / last selected line: 0
  257. -- icon id / first selected line: 0 / 0
  258. -- text alignment: 0
  259. -- font id: 0
  260. -- text size: 12
  261. -- style flags: 0
  262. -- line height: 16
  263. -- part name: 
  264.  
  265.  
  266. -- part 6 (button)
  267. -- low flags: 00
  268. -- high flags: 0000
  269. -- rect: left=455 top=24 right=72 bottom=506
  270. -- title width / last selected line: 0
  271. -- icon id / first selected line: 2478 / 2478
  272. -- text alignment: 1
  273. -- font id: 0
  274. -- text size: 12
  275. -- style flags: 0
  276. -- line height: 16
  277. -- part name: New Button
  278. ----- HyperTalk script -----
  279. on mouseUp
  280.   hide message
  281.   visual effect wipe up slowly
  282.   go to card id 3666
  283. end mouseUp
  284.  
  285.  
  286.  
  287.  
  288. -- part contents for card part 4
  289. ----- text -----
  290. Eliza's Response
  291.  
  292. -- part contents for card part 5
  293. ----- text -----
  294. Human's Response
  295.  
  296. -- part contents for card part 3
  297. ----- text -----
  298. Hi, this is Eliza.  Let me help you. Tell me your problems.